Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix resolving of references to deduped props in lazy elements #30441

Merged

Conversation

unstubbable
Copy link
Contributor

@unstubbable unstubbable commented Jul 24, 2024

When a model references a deduped object of a blocked element that has subsequently been turned into a lazy element, we need to wait for the lazy element's chunk to resolve before resolving the reference.

Without the fix, the new test failed with the following runtime error:

TypeError: Cannot read properties of undefined (reading 'children')
  1003 |       let value = chunk.value;
  1004 |       for (let i = 1; i < path.length; i++) {
> 1005 |         value = value[path[i]];
       |                          ^
  1006 |       }
  1007 |       const chunkValue = map(response, value);
  1008 |       if (__DEV__ && chunk._debugInfo) {

  at getOutlinedModel (packages/react-client/src/ReactFlightClient.js:1005:26)

The bug was uncovered after updating React in Next.js in vercel/next.js#66711.

The bug was uncovered after updating React in Next.js in
vercel/next.js#66711.

The test fails with:

```
TypeError: Cannot read properties of undefined (reading 'children')
  1003 |       let value = chunk.value;
  1004 |       for (let i = 1; i < path.length; i++) {
> 1005 |         value = value[path[i]];
       |                          ^
  1006 |       }
  1007 |       const chunkValue = map(response, value);
  1008 |       if (__DEV__ && chunk._debugInfo) {

  at getOutlinedModel (packages/react-client/src/ReactFlightClient.js:1005:26)
```
Copy link

vercel bot commented Jul 24, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-compiler-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 24, 2024 10:21pm

@react-sizebot
Copy link

react-sizebot commented Jul 24, 2024

Comparing: 933b737...2aa5ada

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.js = 6.68 kB 6.68 kB = 1.83 kB 1.82 kB
oss-stable/react-dom/cjs/react-dom-client.production.js = 501.44 kB 501.44 kB = 89.98 kB 89.98 kB
oss-experimental/react-dom/cjs/react-dom.production.js = 6.69 kB 6.69 kB = 1.83 kB 1.83 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js = 506.26 kB 506.26 kB = 90.68 kB 90.68 kB
facebook-www/ReactDOM-prod.classic.js = 599.78 kB 599.78 kB = 105.88 kB 105.88 kB
facebook-www/ReactDOM-prod.modern.js = 575.83 kB 575.83 kB = 102.15 kB 102.15 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable-rc/react-server-dom-esm/cjs/react-server-dom-esm-client.browser.production.js +0.77% 45.99 kB 46.35 kB +0.43% 9.46 kB 9.50 kB
oss-stable-semver/react-server-dom-esm/cjs/react-server-dom-esm-client.browser.production.js +0.77% 45.99 kB 46.35 kB +0.43% 9.46 kB 9.50 kB
oss-stable/react-server-dom-esm/cjs/react-server-dom-esm-client.browser.production.js +0.77% 45.99 kB 46.35 kB +0.43% 9.46 kB 9.50 kB
oss-experimental/react-server-dom-esm/cjs/react-server-dom-esm-client.browser.production.js +0.76% 46.50 kB 46.85 kB +0.42% 9.53 kB 9.57 kB
oss-stable-rc/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.browser.production.js +0.74% 47.60 kB 47.96 kB +0.42% 9.83 kB 9.87 kB
oss-stable-semver/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.browser.production.js +0.74% 47.60 kB 47.96 kB +0.42% 9.83 kB 9.87 kB
oss-stable/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.browser.production.js +0.74% 47.60 kB 47.96 kB +0.42% 9.83 kB 9.87 kB
oss-stable-rc/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.production.js +0.74% 47.94 kB 48.29 kB +0.42% 9.92 kB 9.96 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.production.js +0.74% 47.94 kB 48.29 kB +0.42% 9.92 kB 9.96 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.production.js +0.74% 47.94 kB 48.29 kB +0.42% 9.92 kB 9.96 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.browser.production.js +0.73% 48.10 kB 48.46 kB +0.40% 9.90 kB 9.94 kB
oss-stable-rc/react-client/cjs/react-client-flight.production.js +0.73% 51.85 kB 52.23 kB +0.36% 9.65 kB 9.68 kB
oss-stable-semver/react-client/cjs/react-client-flight.production.js +0.73% 51.85 kB 52.23 kB +0.36% 9.65 kB 9.68 kB
oss-stable/react-client/cjs/react-client-flight.production.js +0.73% 51.85 kB 52.23 kB +0.36% 9.65 kB 9.68 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.production.js +0.73% 48.44 kB 48.79 kB +0.41% 9.99 kB 10.03 kB
oss-experimental/react-client/cjs/react-client-flight.production.js +0.73% 52.25 kB 52.63 kB +0.39% 9.69 kB 9.73 kB
oss-stable-rc/react-server-dom-esm/cjs/react-server-dom-esm-client.node.production.js +0.70% 50.20 kB 50.55 kB +0.43% 10.48 kB 10.52 kB
oss-stable-semver/react-server-dom-esm/cjs/react-server-dom-esm-client.node.production.js +0.70% 50.20 kB 50.55 kB +0.43% 10.48 kB 10.52 kB
oss-stable/react-server-dom-esm/cjs/react-server-dom-esm-client.node.production.js +0.70% 50.20 kB 50.55 kB +0.43% 10.48 kB 10.52 kB
oss-experimental/react-server-dom-esm/cjs/react-server-dom-esm-client.node.production.js +0.70% 50.70 kB 51.05 kB +0.45% 10.54 kB 10.59 kB
oss-stable-rc/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.node.unbundled.production.js +0.69% 51.45 kB 51.81 kB +0.41% 10.75 kB 10.80 kB
oss-stable-semver/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.node.unbundled.production.js +0.69% 51.45 kB 51.81 kB +0.41% 10.75 kB 10.80 kB
oss-stable/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.node.unbundled.production.js +0.69% 51.45 kB 51.81 kB +0.41% 10.75 kB 10.80 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.node.unbundled.production.js +0.68% 51.96 kB 52.31 kB +0.43% 10.82 kB 10.87 kB
oss-stable-rc/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.node.production.js +0.68% 52.15 kB 52.51 kB +0.41% 10.91 kB 10.95 kB
oss-stable-semver/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.node.production.js +0.68% 52.15 kB 52.51 kB +0.41% 10.91 kB 10.95 kB
oss-stable/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.node.production.js +0.68% 52.15 kB 52.51 kB +0.41% 10.91 kB 10.95 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.node.production.js +0.67% 52.65 kB 53.01 kB +0.42% 10.98 kB 11.02 kB
oss-stable-rc/react-server-dom-webpack/cjs/react-server-dom-webpack-client.edge.production.js +0.66% 53.30 kB 53.65 kB +0.41% 11.13 kB 11.18 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-client.edge.production.js +0.66% 53.30 kB 53.65 kB +0.41% 11.13 kB 11.18 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-client.edge.production.js +0.66% 53.30 kB 53.65 kB +0.41% 11.13 kB 11.18 kB
oss-stable-rc/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.edge.production.js +0.66% 53.31 kB 53.66 kB +0.41% 11.12 kB 11.17 kB
oss-stable-semver/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.edge.production.js +0.66% 53.31 kB 53.66 kB +0.41% 11.12 kB 11.17 kB
oss-stable/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.edge.production.js +0.66% 53.31 kB 53.66 kB +0.41% 11.12 kB 11.17 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-client.edge.production.js +0.66% 53.80 kB 54.15 kB +0.40% 11.20 kB 11.25 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.edge.production.js +0.66% 53.81 kB 54.16 kB +0.41% 11.19 kB 11.23 kB
oss-stable-rc/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.unbundled.production.js +0.64% 55.05 kB 55.40 kB +0.39% 11.26 kB 11.30 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.unbundled.production.js +0.64% 55.05 kB 55.40 kB +0.39% 11.26 kB 11.30 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.unbundled.production.js +0.64% 55.05 kB 55.40 kB +0.39% 11.26 kB 11.30 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.unbundled.production.js +0.64% 55.53 kB 55.88 kB +0.41% 11.33 kB 11.38 kB
oss-stable-rc/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.production.js +0.63% 55.73 kB 56.09 kB +0.39% 11.42 kB 11.47 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.production.js +0.63% 55.73 kB 56.09 kB +0.39% 11.42 kB 11.47 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.production.js +0.63% 55.73 kB 56.09 kB +0.39% 11.42 kB 11.47 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.production.js +0.63% 56.22 kB 56.57 kB +0.39% 11.49 kB 11.54 kB
oss-stable-rc/react-server-dom-esm/cjs/react-server-dom-esm-client.browser.development.js +0.55% 73.31 kB 73.71 kB +0.25% 13.81 kB 13.84 kB
oss-stable-semver/react-server-dom-esm/cjs/react-server-dom-esm-client.browser.development.js +0.55% 73.31 kB 73.71 kB +0.25% 13.81 kB 13.84 kB
oss-stable/react-server-dom-esm/cjs/react-server-dom-esm-client.browser.development.js +0.55% 73.31 kB 73.71 kB +0.25% 13.81 kB 13.84 kB
oss-stable-rc/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.browser.development.js +0.54% 75.17 kB 75.57 kB +0.26% 14.21 kB 14.25 kB
oss-stable-semver/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.browser.development.js +0.54% 75.17 kB 75.57 kB +0.26% 14.21 kB 14.25 kB
oss-stable/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.browser.development.js +0.54% 75.17 kB 75.57 kB +0.26% 14.21 kB 14.25 kB
oss-stable-rc/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.development.js +0.53% 75.62 kB 76.02 kB +0.29% 14.33 kB 14.37 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.development.js +0.53% 75.62 kB 76.02 kB +0.29% 14.33 kB 14.37 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.development.js +0.53% 75.62 kB 76.02 kB +0.29% 14.33 kB 14.37 kB
oss-experimental/react-server-dom-esm/cjs/react-server-dom-esm-client.browser.development.js +0.53% 76.88 kB 77.28 kB +0.30% 14.51 kB 14.56 kB
oss-stable-rc/react-client/cjs/react-client-flight.development.js +0.52% 77.01 kB 77.41 kB +0.22% 14.16 kB 14.19 kB
oss-stable-semver/react-client/cjs/react-client-flight.development.js +0.52% 77.01 kB 77.41 kB +0.22% 14.16 kB 14.19 kB
oss-stable/react-client/cjs/react-client-flight.development.js +0.52% 77.01 kB 77.41 kB +0.22% 14.16 kB 14.19 kB
oss-stable-rc/react-server-dom-esm/cjs/react-server-dom-esm-client.node.development.js +0.52% 78.25 kB 78.65 kB +0.27% 14.84 kB 14.88 kB
oss-stable-semver/react-server-dom-esm/cjs/react-server-dom-esm-client.node.development.js +0.52% 78.25 kB 78.65 kB +0.27% 14.84 kB 14.88 kB
oss-stable/react-server-dom-esm/cjs/react-server-dom-esm-client.node.development.js +0.52% 78.25 kB 78.65 kB +0.27% 14.84 kB 14.88 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.browser.development.js +0.51% 78.73 kB 79.14 kB +0.28% 14.93 kB 14.97 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.development.js +0.51% 79.25 kB 79.65 kB +0.28% 15.04 kB 15.09 kB
oss-stable-rc/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.node.unbundled.development.js +0.51% 79.66 kB 80.06 kB +0.27% 15.15 kB 15.19 kB
oss-stable-semver/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.node.unbundled.development.js +0.51% 79.66 kB 80.06 kB +0.27% 15.15 kB 15.19 kB
oss-stable/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.node.unbundled.development.js +0.51% 79.66 kB 80.06 kB +0.27% 15.15 kB 15.19 kB
oss-stable-rc/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.node.development.js +0.50% 80.56 kB 80.97 kB +0.24% 15.32 kB 15.35 kB
oss-stable-semver/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.node.development.js +0.50% 80.56 kB 80.97 kB +0.24% 15.32 kB 15.35 kB
oss-stable/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.node.development.js +0.50% 80.56 kB 80.97 kB +0.24% 15.32 kB 15.35 kB
oss-experimental/react-client/cjs/react-client-flight.development.js +0.50% 80.67 kB 81.08 kB +0.24% 14.81 kB 14.84 kB
oss-experimental/react-server-dom-esm/cjs/react-server-dom-esm-client.node.development.js +0.49% 81.87 kB 82.28 kB +0.31% 15.53 kB 15.58 kB
oss-stable-rc/react-server-dom-webpack/cjs/react-server-dom-webpack-client.edge.development.js +0.49% 81.93 kB 82.33 kB +0.31% 15.59 kB 15.64 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-client.edge.development.js +0.49% 81.93 kB 82.33 kB +0.31% 15.59 kB 15.64 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-client.edge.development.js +0.49% 81.93 kB 82.33 kB +0.31% 15.59 kB 15.64 kB
oss-stable-rc/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.edge.development.js +0.49% 81.94 kB 82.35 kB +0.31% 15.57 kB 15.62 kB
oss-stable-semver/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.edge.development.js +0.49% 81.94 kB 82.35 kB +0.31% 15.57 kB 15.62 kB
oss-stable/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.edge.development.js +0.49% 81.94 kB 82.35 kB +0.31% 15.57 kB 15.62 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.node.unbundled.development.js +0.49% 83.29 kB 83.69 kB +0.26% 15.86 kB 15.90 kB
oss-stable-rc/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.unbundled.development.js +0.48% 83.67 kB 84.07 kB +0.25% 15.68 kB 15.72 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.unbundled.development.js +0.48% 83.67 kB 84.07 kB +0.25% 15.68 kB 15.72 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.unbundled.development.js +0.48% 83.67 kB 84.07 kB +0.25% 15.68 kB 15.72 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.node.development.js +0.48% 84.10 kB 84.50 kB +0.26% 16.03 kB 16.07 kB
oss-stable-rc/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.development.js +0.48% 84.46 kB 84.86 kB +0.23% 15.86 kB 15.90 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.development.js +0.48% 84.46 kB 84.86 kB +0.23% 15.86 kB 15.90 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.development.js +0.48% 84.46 kB 84.86 kB +0.23% 15.86 kB 15.90 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-client.edge.development.js +0.47% 85.46 kB 85.87 kB +0.25% 16.31 kB 16.35 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.edge.development.js +0.47% 85.48 kB 85.88 kB +0.25% 16.29 kB 16.33 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.unbundled.development.js +0.46% 87.20 kB 87.61 kB +0.24% 16.39 kB 16.43 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.development.js +0.46% 88.00 kB 88.40 kB +0.25% 16.57 kB 16.61 kB
oss-stable-rc/react-server-dom-esm/esm/react-server-dom-esm-client.browser.production.js +0.45% 76.26 kB 76.61 kB +0.25% 16.25 kB 16.29 kB
oss-stable-semver/react-server-dom-esm/esm/react-server-dom-esm-client.browser.production.js +0.45% 76.26 kB 76.61 kB +0.25% 16.25 kB 16.29 kB
oss-stable/react-server-dom-esm/esm/react-server-dom-esm-client.browser.production.js +0.45% 76.26 kB 76.61 kB +0.25% 16.25 kB 16.29 kB
oss-experimental/react-server-dom-esm/esm/react-server-dom-esm-client.browser.production.js +0.45% 77.00 kB 77.34 kB +0.25% 16.35 kB 16.39 kB
oss-stable-rc/react-server-dom-esm/esm/react-server-dom-esm-client.browser.development.js +0.33% 103.80 kB 104.15 kB +0.18% 23.32 kB 23.37 kB
oss-stable-semver/react-server-dom-esm/esm/react-server-dom-esm-client.browser.development.js +0.33% 103.80 kB 104.15 kB +0.18% 23.32 kB 23.37 kB
oss-stable/react-server-dom-esm/esm/react-server-dom-esm-client.browser.development.js +0.33% 103.80 kB 104.15 kB +0.18% 23.32 kB 23.37 kB
oss-experimental/react-server-dom-esm/esm/react-server-dom-esm-client.browser.development.js +0.31% 109.89 kB 110.24 kB +0.20% 24.65 kB 24.70 kB

Generated by 🚫 dangerJS against f0aee7c

@unstubbable unstubbable changed the title Add a failing test for resolving blocked references of lazy elements Fix resolving of references to deduped props in lazy elements Jul 24, 2024
@sebmarkbage sebmarkbage merged commit 7600225 into facebook:main Jul 24, 2024
187 checks passed
@unstubbable unstubbable deleted the failing-test-for-blocked-references branch July 25, 2024 07:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants